<template>
    <div class="video">
        <!-- 上传作品类型 -->


        <!-- 作品显示区域 -->
        <div class="videoVideo">
            <div class="videoVideoWord">
                <p>我的视频</p>
            </div>
            <div class="videoVideoContent" >
                <div class="shiping" v-for="item in videoList" :key="item.id">
                    <div class="fengmian">
                        <img :src="item.imgUrl" alt="">
                    </div>
                    <p class="shipingTitle">{{item.name}}</p>
                    <p class="shipingDate">{{item.time}}</p>
                    <div class="shanchu">
                        <button @click="shanchu(item.id)">删除</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    import {request} from "../../network/request";

    export default {
        data(){
            return{
                videoList:[
                    {
                        id: 0 ,

                        src: 'https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/101b19aca4bb489bcef0f503e44ec866.jpg?thumb=1&w=370&h=225&f=webp&q=90',
                        title: 'title1',
                        date: '2021-1-1'
                    },
                ]
            }
        },

        methods:{
            shanchu(num){
                console.log(num);
                for (let i = 0; i < this.videoList.length; i++) {
                    if(this.videoList[i].id === num){
                        this.videoList.splice(i,1);
                    }

                }

            }
        },
        created() {
            request({
                url:"/getByUserId",
                method: "get",
                params:{
                    userId:parseInt(sessionStorage.getItem("userId"))
                }
            }).then(res=>{
                 console.log(res.data);
                this.videoList = res.data;

            }).catch(err=>{
                console.log(err);
            });
        }

    }
</script>

<style>

    .video{
        width: 800px;
        height: 600px;
        background-color: white;
        margin: 0 auto;
        display: inline-block;
        position: relative;
        top: -280px;
        left: 40px;
    }

    .video:after{
        clear: both;
    }

    .videoType{
        width: 175px;
        height: 600px;
        float: left;
        display: block;
    }

    .videoType ul{
        list-style: none;
    }

    .videoType li{
        width: 175px;   height: 50px;
        line-height: 50px;
        margin-left: 0;

    }

    .videoType li:hover{
        background-color: skyblue;
    }


    .a1{
        display: inline-block;
        width: 60px;    height: 30px;
        line-height: 30px;
        margin-right: 10px;

        text-decoration: none;
        color: black;
    }

    /* .a1 :nth-child(1):visited .videoVideo{
        display: none;
    } */

    .span2{
        margin-left: 30px;
        margin-right: 20px;
    }

    .videoVideo{
        width: 775px;
        height: 600px;
        float: left;
    }


    .videoVideoWord{
        width: 100%;    height: 20px;
        margin-bottom: 15px;
    }

    .videoVideoWord p{
        float: left;
        margin-left: 25px;
    }

    .videoVideoContent{
        width: 100%;    height: 500px;
        margin: 0 auto;
        padding-left: 25px;
    }

    .shiping{
        height: 160px;
        float: left;
        text-align: left;
        margin-left: 25px;
        cursor: pointer;
    }

    .shiping:hover .shanchu{
        display: block;
    }

    .fengmian img{
        width: 160px;       height: 105px;
        border-radius: 5%;
    }

    .shipingTitle:hover{
        color:rgb(252,85,49);
    }

    .shipingDate{
        font-size: 10px;
        color: rgb(207, 204, 204);
    }

    .shanchu{
        width: 160px;       height: 30px;
        text-align: center;
        display: none;
        position: relative;
        left: 0;
        top: -60px;
    }

    .shanchu button{
        width: 140px;       height: 20px;
        background-color: rgba(0,0,0,0.1);
        color: white;
        border: 0;
        cursor: pointer;
    }

    .shanchu button:hover{
        border-radius: 5%;
    }
</style>